import { getUUID } from '/lib/api.js';

export async function initUser() {
    const localStorage = window.localStorage;
    let uuid = localStorage.getItem('uuid');
    if (uuid) {
        return uuid;
    }
    // init uuid
    uuid = await getUUID();
    if (!uuid) {
        window.document.write('无法获取uuid，请联系管理员');
        return;
    }
    localStorage.setItem('uuid', uuid);
    return uuid;
}
